﻿#include "MeteorologicalDataFile.h"
/*********************************************************************************
**                                                                              **
**  Copyright (C) 2024 LiLong                                                   **
**  This file is part of RinexFileReader.                                       **
**                                                                              **
**  RinexFileReader is free software: you can redistribute it and/or modify     **
**  it under the terms of the GNU General Public License as published by        **
**  the Free Software Foundation, either version 3 of the License, or           **
**  (at your option) any later version.                                         **
**                                                                              **
**  RinexFileReader is distributed in the hope that it will be useful,          **
**  but WITHOUT ANY WARRANTY; without even the implied warranty of              **
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               **
**  GNU General Public License for more details.                                **
**                                                                              **
**  You should have received a copy of the GNU General Public License           **
**  along with RinexFileReader. If not, see <https://www.gnu.org/licenses/>.    **
**********************************************************************************/
#include "MeteorologicalDataFile.h"
#include "Private/MeteorologicalData.h"

namespace Rinex
{
struct MeteorologicalDataFile::Impl
{
    std::shared_ptr<MeteorologicalData> data;
};

MeteorologicalDataFile::MeteorologicalDataFile(std::shared_ptr<MeteorologicalData> d) : m_impl(std::make_unique<Impl>(d)) {}

MeteorologicalDataFile::MeteorologicalDataFile(const MeteorologicalDataFile& other) : MeteorologicalDataFile(other.m_impl->data) {}

MeteorologicalDataFile::~MeteorologicalDataFile() {}

MeteorologicalDataFile& MeteorologicalDataFile::operator=(const MeteorologicalDataFile& other)
{
    m_impl->data = other.m_impl->data;
    return *this;
}

double MeteorologicalDataFile::version() const { return m_impl->data->version; }

const std::string& MeteorologicalDataFile::program() const { return m_impl->data->program; }

const std::string& MeteorologicalDataFile::agency() const { return m_impl->data->agency; }

const std::string& MeteorologicalDataFile::createDateTime() const { return m_impl->data->createDateTime; }

const std::vector<std::string>& MeteorologicalDataFile::comments() const { return m_impl->data->comments; }

const std::string& MeteorologicalDataFile::markerName() const { return m_impl->data->markerName; }

const std::optional<std::string>& MeteorologicalDataFile::markerNumber() const { return m_impl->data->markerNumber; }

const std::vector<ObservationType>& MeteorologicalDataFile::observationTypes() const { return m_impl->data->observationTypes; }

const std::vector<SensorModTypeAcc>& MeteorologicalDataFile::sensorModTypeAcc() const { return m_impl->data->sensorModTypeAcc; }

const std::vector<SensorPosXYZH>& MeteorologicalDataFile::sensorPosXYZH() const { return m_impl->data->sensorPosXYZH; }

const std::vector<MetData>& MeteorologicalDataFile::datas() const { return m_impl->data->datas; }

MeteorologicalDataFile& MeteorologicalDataFile::operator=(MeteorologicalDataFile&& other) noexcept
{
    m_impl = std::move(other.m_impl);
    return *this;
}

MeteorologicalDataFile::MeteorologicalDataFile(MeteorologicalDataFile&& other) noexcept : m_impl(std::move(other.m_impl)) {}

} // namespace Rinex